
package com.hlkj.pay.enums;

import lombok.Getter;

/**
 * @author HlpayTeam
 * @date 2024/09/06 18:20
 */
public interface UserEnum {

    @Getter
    enum USER_TYPE {

        TELE(1, "话费"),

        ;

        /**
         * 错误码
         */
        private Integer code;

        /**
         * 错误提示
         */
        private String msg;

        USER_TYPE(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public static USER_TYPE from(Integer key) {
            USER_TYPE[] values = USER_TYPE.values();
            for (USER_TYPE deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return USER_TYPE.TELE;
        }
    }

    @Getter
    enum USER_STATUS {

        ABLE(1, "启用"), ENABLE(0, "禁用"),

        ;

        /**
         * 错误码
         */
        private Integer code;

        /**
         * 错误提示
         */
        private String msg;

        USER_STATUS(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public static USER_STATUS from(Integer key) {
            USER_STATUS[] values = USER_STATUS.values();
            for (USER_STATUS deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return USER_STATUS.ABLE;
        }
    }
    @Getter
    enum USER_COUPON_STATUS {
        //1:未使用、2:已使用、3:已过期）
        NO_USE(1, "未使用"), USED(2, "已使用"), EXPIRED(3, "已过期"),

        ;

        /**
         * 错误码
         */
        private Integer code;

        /**
         * 错误提示
         */
        private String msg;
        
        USER_COUPON_STATUS(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public static USER_COUPON_STATUS from(Integer key) {
            USER_COUPON_STATUS[] values = USER_COUPON_STATUS.values();
            for (USER_COUPON_STATUS deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return USER_COUPON_STATUS.NO_USE;
        }
    }
    @Getter
    enum RECHARGE_STATUS {
        //订单状态，1=待支付，2=已支付，3=充值中，4=已充值 5=充值失败
        //1:未使用、2:已使用、3:已过期）
        WAIT_PAY(1, "待支付"), PAY(2, "已支付"),DOING(3, "充值中"), SUCCESS(4, "已充值"), FAIL(5, "充值失败"),

        ;

        /**
         * 错误码
         */
        private Integer code;

        /**
         * 错误提示
         */
        private String msg;
        
        RECHARGE_STATUS(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }
        public static RECHARGE_STATUS from(Integer key) {
            RECHARGE_STATUS[] values = RECHARGE_STATUS.values();
            for (RECHARGE_STATUS deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return RECHARGE_STATUS.WAIT_PAY;
        }
    }

}
